package com.carl.zlds.controller.web;

import com.carl.zlds.tool.common.result.Result;
import com.carl.zlds.annotation.Login;
import com.carl.zlds.pojo.vo.ArticleVO;
import com.carl.zlds.service.IArticleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author carl
 */
@Slf4j
@RestController(value = "web.articleController")
@RequestMapping("/web/article")
@Api(tags = {"客户端 - 文章管理"})
public class ArticleController {
    private final IArticleService articleService;

    @Autowired
    public ArticleController(IArticleService articleService) {
        this.articleService = articleService;
    }

    @ApiOperation("详情")
    @GetMapping(value = "/info")
    @Login(needToken = false)
    public Result<ArticleVO> info(@RequestParam("id") Long id) {
        ArticleVO articleInfo = articleService.getArticleInfo(id);
        return Result.success(articleInfo);
    }
}
